﻿using System;
using System.Collections.Generic;
using System.Text;

namespace VGS {
    /// <summary>
    /// Type of point. Attacking or defending.
    /// </summary>
    public enum PointType {
        POINT_ATTACK, // attacking point
        POINT_DEFENSE, // defending point
        POINT_SERVE // The player did a winning serve
    }

    /// <summary>
    /// A class that represent each point
    /// </summary>
    public class SetPoint {
        private TeamEnum? team; // team that scored
        private Player player = null; // player who did the score (if any specific)
        private PointType? type; // type of point

        #region Constructors (2)
        /// <summary>
        /// Adds a point for the specified team, but not a specific player
        /// </summary>
        /// <param name="team"></param>
        public SetPoint(TeamEnum team)
        {
            this.team = team;
            this.player = null;
        }


        /// <summary>
        /// The constructor specifies which team who won and which player and which
        /// type of score it was.
        /// </summary>
        /// <param name="team">Team that scored</param>
        /// <param name="shirt_nr">Player's shirt number</param>
        public SetPoint(TeamEnum team, Player player, PointType? type)
        {
            this.team = team;
            this.player = player;
            this.type = type;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets the team that made the score
        /// </summary>
        public TeamEnum? Team
        {
            get
            {
                return team;
            }
        }


        /// <summary>
        /// Get the player player that did the score. In case no specific
        /// player scored, but the 'whole' team, null is returned.
        /// </summary>
        public Player Player
        {
            get
            {
                return player;
            }
        }

        /// <summary>
        /// Gets the type. This value can be null.
        /// </summary>
        public PointType? Type
        {
            get
            {
                return type;
            }
        }
        #endregion
    }
}
